﻿$(function () {
    setIframeSize();

    $("#about").click(function () {
        layer.open({
            type: 2,
            title: "<i class=\"fa fa-info-circle\"></i> 关于",
            shadeClose: false,
            shade: 0.6,
            maxmin: false,
            area: ["500px", "270px"],
            content: ["/pages/sys/about.aspx",'no']
        });
    });

    $("#new").click(function () {
        $("#main").attr("src", $(this).data("url"));
    });

    $("#run").click(function () {
        if ($("#hid_project").val() != "") {
            RunProject($("#hid_project").val());
        }
        else {
            layer.alert("请选择要运行的项目", { title:'系统提示',icon:5});
        }
    });

    $("#exit").click(function () {

    });

    $(window).resize(function () {
        setIframeSize();
    });
})

function setIframeSize() {
    $("#main").height($(document).height() - $(".main-header").height() * 2);
}

function setProject(pid) {
    $("#hid_project").val(pid);
    setCanRun();
}

function setCanRun() {
    var pid = $("#hid_project").val();
    if (pid != "") {
        $("#run").attr("data-url", "pages/sys/run.aspx?p=" + pid);
        $("#run").find(".text-gray").removeClass("text-gray").addClass("text-green");
    }
    else {
        $("#run").children().removeClass("text-green").addClass("text-gray");
    }
}